<template>
	<view class="accelerate_order_details">
		<view class="head_box">
			<view class="order-box">
				<view class="order_con">加速订单</view>
				<view class="order_con">{{order_no}}</view>
			</view>
		</view>
		<mescroll-uni @getData="getData" ref="mescroll" top="128">
			<block slot="list">
				<block v-if="dataList.length > 0">
					<view class="list-box">
						<view class="list-item" v-for="(item,index) in dataList" :key="">
							<view class="p-one">
								<view class="p-one-left">
									<view class="state_label">{{item.type == 0 ? '到店' : '分享'}}</view>
									<view class="order_num">{{item.order_no}}</view>
								</view>
								<view class="p-one-right">加速补贴{{item.practical_value}}</view>
							</view>
							<view class="p-two">
								<view class="p-two-left">
									<image class="head_img" :src="$util.img(item.headimg)" mode=""></image>
									<view class="name_label">{{item.nickname}}</view>
								</view>
								<view class="time-label">{{$util.timeStampTurnTime(item.create_time)}}</view>
							</view>
						</view>
					</view>
				</block>
				<block v-else>
					<ns-empty :isIndex="false" :fixed="true" text="暂无数据"></ns-empty>
				</block>
			</block>
		</mescroll-uni>
		<loading-cover ref="loadingCover"></loading-cover>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dataList: [],
				order_no: ''
			}
		},
		onLoad(opts) {
			if (opts.order_no) {
				this.order_no = opts.order_no;
			}
		},
		methods: {
			getData(mescroll) {
				this.$api.sendRequest({
					url: '/expansion/api/Record/accelerateDetailPage',
					data: {
						page: mescroll.num,
						page_size: mescroll.size,
						order_no: this.order_no
					},
					success: res => {
						let newArr = [];
						let msg = res.message;
						if (res.code == 0 && res.data) {
							newArr = res.data.list;
						} else {
							this.$util.showToast({
								title: msg
							});
						}
						if (mescroll.endSuccess) mescroll.endSuccess(newArr.length);
						//设置列表数据
						if (mescroll.num == 1) this.dataList = []; //如果是第一页需手动制空列表
						this.dataList = this.dataList.concat(newArr); //追加新数据
						if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
					},
					fail() {
						//联网失败的回调
						if (mescroll.endErr) mescroll.endErr();
						if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.accelerate_order_details {
		.head_box {
			width: 100vw;
			height: 128rpx;
			padding: 24rpx 24rpx 0 24rpx;

			.order-box {
				width: 100%;
				height: 100%;
				background-color: #004FC6;
				border-radius: 12rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding: 0 24rpx;

				.order_con {
					font-family: PingFang SC, PingFang SC;
					font-weight: 500;
					font-size: 32rpx;
					color: #FFFFFF;
					line-height: 44rpx;
				}
			}
		}

		.list-box {
			padding: 0 24rpx;

			.list-item {
				margin-top: 24rpx;
				background-color: #fff;
				border-radius: 20rpx;
				padding: 28rpx 24rpx 32rpx 24rpx;

				.p-one {
					display: flex;
					align-items: center;
					justify-content: space-between;

					.p-one-left {
						display: flex;
						align-items: center;

						.state_label {
							font-family: PingFang SC, PingFang SC;
							font-weight: 400;
							font-size: 22rpx;
							color: #FFFFFF;
							line-height: 30rpx;
							background-color: #004FC6;
							border-radius: 4rpx;
							margin-right: 8rpx;
							padding: 1rpx 10rpx;
						}

						.order_num {
							font-family: PingFang SC, PingFang SC;
							font-weight: 400;
							font-size: 28rpx;
							color: #666666;
							line-height: 40rpx;
						}
					}

					.p-one-right {
						font-family: PingFang SC, PingFang SC;
						font-weight: 500;
						font-size: 28rpx;
						color: #F53F3F;
						line-height: 40rpx;
					}
				}

				.p-two {
					display: flex;
					align-items: center;
					justify-content: space-between;
					margin-top: 42rpx;

					.p-two-left {
						display: flex;
						align-items: center;

						.head_img {
							width: 40rpx;
							height: 40rpx;
							border-radius: 50%;
						}

						.name_label {
							font-family: PingFang SC, PingFang SC;
							font-weight: 400;
							font-size: 24rpx;
							color: #666666;
							line-height: 34rpx;
							margin-left: 8rpx;
						}
					}

					.time-label {
						font-family: PingFang SC, PingFang SC;
						font-weight: 400;
						font-size: 24rpx;
						color: #999999;
						line-height: 34rpx;
					}
				}
			}
		}
	}

	page {
		background-color: #F2F3F5;
	}

	view {
		box-sizing: border-box;
	}
</style>